package com.you.atlas.web.member.module.action;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.china.fasttext.json.JSONObject;
import com.alibaba.citrus.service.form.Group;
import com.alibaba.citrus.turbine.Navigator;
import com.alibaba.citrus.turbine.dataresolver.FormGroup;
import com.you.common.webx.AuthContext;
import com.you.member.biz.service.FeedService;

public class BroadcastAction {

    @Autowired
    private FeedService feedService;

    public void doPost(@FormGroup("postBoradcast") Group group, Navigator navigator) {

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("content", group.getField("content").getValue().toString());
        jsonObject.put("action", "addBroadcast");
        feedService.send(AuthContext.getContext().getMemberId(), jsonObject);

        navigator.redirectTo("memberModule").withTarget("me.vm");
    }
}
